/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.worlds.ui.edge;

import java.awt.image.BufferedImage;


public class EToggleButton extends EButton{
    public boolean down = false;
    private EButtonGroup buttonGroup;
    public EToggleButton(String text)
    {
        super(text);
    }
    public EToggleButton(BufferedImage img)
    {
        super(img);
    }
    public void setButtonGroup(EButtonGroup group)
    {
        buttonGroup = group;
        group.addButton(this);
    }
    @Override
    public void mousePressed()
    {
        super.mousePressed();
        if(down && buttonGroup == null)
        {
            down = false;
            showEdges = false;
        }
        else
        {
            if(buttonGroup != null)
                buttonGroup.clear();
            down = true;
            showEdges = true;
        }
    }
}
